<?php

namespace Wilead\IArtistBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Wilead\IArtistBundle\Entity\User;

class UserManagerType extends AbstractType {

    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
                ->add('mobile', null, array(
                    'label' => '手机号码',
                    'read_only' => TRUE
                ))
                ->add('signature', null, array(
                    'label' => '个人签名',
                    'read_only' => TRUE
                ))
                ->add('nickname', null, array(
                    'label' => '呢称',
                    'read_only' => TRUE
                ))
                ->add('sex', 'choice', array(
                    'label' => '性别',
                    'choices' => array('m' => '男', 'f' => '女')
                ))
                ->add('accountType', 'choice', array(
                    'label' => '账号类型',
                    'choices' => array(User::ACCOUNT_TYPE_ARTIST => '艺人', User::ACCOUNT_TYPE_ORGANIZATION => '机构')
                ))
                ->add('memberExpiredAt', 'date', array(
                    'widget' => 'choice',
                    'label' => '会员到期时间',
                    'empty_value' => '',
                    'required' => FALSE
                ))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'Wilead\IArtistBundle\Entity\User',
            'csrf_protection' => false,
        ));
    }

    public function getName() {
        return 'usermanagertype';
    }

}
